package com.archgeek.java.biz.filetime;

import java.io.File;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * @author pizhihui
 * @date 2023-08-21 14:15
 */
public class FileTimeDemo {


    public static void main(String[] args) {

        // 1689920596257
        // 1677424871000
        long filterMilli = LocalDateTime.now().minusMonths(1).toInstant(ZoneOffset.of("+8")).toEpochMilli();
        System.out.println(filterMilli);

        File file = new File("/home/product/logs/dolphinscheduler_worker_logs");
        for (File listFile : file.listFiles()) {
            if (listFile.isDirectory()) {
                long l = listFile.lastModified();
                if (l > filterMilli) {
                    System.out.println(listFile + " 目录的更新时间是: " + l);
                }
            }
        }

    }

}
